package com.md.livingwidget.uiutils;

import android.content.Context;
import android.graphics.drawable.Drawable;

import com.sdsmdg.harjot.vectormaster.VectorMasterDrawable;
import com.sdsmdg.harjot.vectormaster.models.PathModel;


public class SvgUtil {

    public static Drawable convertSvg2SkinDrawable(Context context, int resID, int replaceColor) {
        return convertSvg2SkinDrawable(context, resID, replaceColor, "skin");
    }

    public static Drawable convertSvg2SkinDrawable2(Context context, int resID, int replaceColor) {
        return convertSvg2SkinDrawable(context, resID, replaceColor, "skin", "skin1");
    }

    private static Drawable convertSvg2SkinDrawable(Context context, int resID, int replaceColor, String... names) {
        VectorMasterDrawable drawable = new VectorMasterDrawable(context, resID);
        for (String name : names) {
            PathModel pathModel = drawable.getPathModelByName(name);
            if (pathModel != null) {
                pathModel.setFillColor(replaceColor);
            }
        }
        return drawable;
    }


}
